import React from 'react';
import { createAppContainer } from 'react-navigation';
import { Provider } from 'mobx-react';
import AppRouter from './navigation/AppNavigator';
import store from './store';
import storage from './dao/index';
import SplashScreen from 'react-native-splash-screen';

const AppContainer = createAppContainer(AppRouter);

export default class App extends React.Component {
    constructor() {
        super();
        // 挂载本地存储
        global.storage = storage;
    }
    componentDidMount() {
        // 手动关闭启动页 延迟关闭启动页, 等待处理完版本升级 和 验证登录逻辑
        setTimeout(() => {
            SplashScreen.hide();
        }, 1);
    }

    render() {
        return (
            <Provider {...store}>
                <AppContainer/>
            </Provider>
        );
    }
}
